package com.yu.yupicture.model.enums;

import lombok.Getter;

@Getter
public enum UserRoleEnums {
    USER("普通用户", "user"),
    ADMIN("管理员", "admin");

    private final String text;
    private final String value;

    UserRoleEnums(String text, String value) {
        this.text = text;
        this.value = value;
    }

     public static UserRoleEnums getByValue(String value){
        if(value==null){
            return null;
        }
         for (UserRoleEnums userRoleEnums : UserRoleEnums.values()) {
             if(userRoleEnums.value.equals(value)){
                 return userRoleEnums;
             }
         }
         return null;
     }
}
